﻿@model IEnumerable<MyDay.Models.Todo>

@{
    ViewBag.Title = "Todos";
}

@if (Session["FlashSuccess"] != null)
    {
        <div class="alert alert-success">
            <button type="button" class="close" data-dismiss="alert">×</button>
            <h4>Success</h4>
            @Session["FlashSuccess"]
            @{
                Session["FlashSuccess"] = null;
            }
        </div>
    }

@if (Session["FlashError"] != null)
    {
        <div class="alert alert-error">
            <button type="button" class="close" data-dismiss="alert">×</button>
            <h4>Oops</h4>
            @Session["FlashError"]
            @{
                Session["FlashError"] = null;
            }
        </div>
    }

<h2>Todos</h2>

<p>
    @Html.ActionLink("Create New", "Create", null, new { @class = "btn btn-success" })
</p>

<div class="row-fluid">
    <div class="span6">

        <h4>Not Done Yet</h4>
        <table class="table table-hover table-bordered">
            <tr>
                <th>
                    @Html.DisplayNameFor(model => model.IsComplete)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Subject)
                </th>
                <th></th>
            </tr>

            @foreach (var item in Model)
            {
                <tr>
                    <td width="20%">
                        @Html.DisplayFor(modelItem => item.IsComplete)
                    </td>
                    <td>
                        @Html.ActionLink(item.Subject, "Edit", new { id = item.ID })
                    </td>
                    <td>
                        @Html.ActionLink("Delete", "Delete", new { id = item.ID })
                    </td>
                </tr>
            }

        </table>
    </div>
    <div class="span6">

        <h4>Done!</h4>
        <table class="table table-hover table-bordered">
            <tr>
                <th width="20%">
                    @Html.DisplayNameFor(model => model.IsComplete)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Subject)
                </th>
                <th></th>
            </tr>

            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.IsComplete)
                    </td>
                    <td>
                        @Html.ActionLink(item.Subject, "Edit", new { id = item.ID })
                    </td>
                    <td>
                        @Html.ActionLink("Delete", "Delete", new { id = item.ID })
                    </td>
                </tr>
            }

        </table>
    </div>
</div>


